﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Slf;
using SLLoggingClient.LoggingHost;

namespace SLLoggingClient
{
  public class ServiceClientLogger : LoggerBase
  {
    /// <summary>
    /// Creates a new log entry based on a given log item.
    /// </summary>
    /// <param name="item">Encapsulates logging information.</param>
    /// <exception cref="ArgumentNullException">If <paramref name="item"/>
    /// is a null reference.</exception>
    public override void Log(LogItem item)
    {
      var client = new LoggingServiceClient();
      client.LogCompleted += (s, a) => client.CloseAsync();
      client.LogAsync(item.LogLevel, item.Message);
    }
  }
}
